from . import *


# 初始化 flask app
def create_app():
    app = Flask(__name__)

    app.config.from_object(config)

    db.init_app(app)

    for blueprint in blueprints:
        app.register_blueprint(
            blueprint=blueprint[0],
            url_prefix=blueprint[1]
        )

    @app.teardown_appcontext
    def date_base_close(exception):
        db.session.close()

    return app
